# -----------------------------------------------------------------
# $Revision: 1.10.2.3 $
# $Date: 2005/03/18 23:25:21 $
# -----------------------------------------------------------------
# Programmer(s): Radu Serban and Aaron Collier @ LLNL
# -----------------------------------------------------------------
# Copyright (c) 2002, The Regents of the University of California.
# Produced at the Lawrence Livermore National Laboratory.
# All rights reserved.
# For details, see sundials/cvode/LICENSE.
# -----------------------------------------------------------------
# Makefile for FCVODE serial examples
#
# @configure_input@
# -----------------------------------------------------------------

SHELL = @SHELL@

srcdir       = @srcdir@
top_builddir = @top_builddir@
builddir     = @builddir@
prefix       = @prefix@
exec_prefix  = @exec_prefix@
includedir   = @includedir@
libdir       = @libdir@

INSTALL = @INSTALL@

@LIBTOOL_CMD@

F77     = @F77@
FFLAGS  = @FFLAGS@
FLIBS   = @FLIBS@
CC      = @CC@
LDFLAGS = @LDFLAGS@
LIBS    = @LIBS@

COMPILER_PREFIX = @COMPILER_PREFIX@
LINKER_PREFIX   = @LINKER_PREFIX@

SUNDIALS_LIB_DIR = $(libdir)
SUNDIALS_LIBS    = -lsundials_fcvode -lsundials_cvode -lsundials_fnvecserial -lsundials_nvecserial -lsundials_shared

EXEC_FILES = cvdensef cvbandf cvkryf cvkrybf

all: $(EXEC_FILES)

fortran_update.sh:
	@${INSTALL} ${top_builddir}/config/fortran_update.sh ${builddir}

cvdensef: $(srcdir)/cvdensef.f fortran_update.sh
	@${SHELL} ${builddir}/fortran_update.sh ${srcdir} cvdensef.f
	$(COMPILER_PREFIX) $(F77) $(FFLAGS) -c $(builddir)/cvdensef-updated.f
	$(LINKER_PREFIX) $(CC) -o $(builddir)/cvdensef $(builddir)/cvdensef-updated.o $(LDFLAGS) -L$(SUNDIALS_LIB_DIR) $(SUNDIALS_LIBS) $(LIBS) $(FLIBS) 

cvbandf: $(srcdir)/cvbandf.f fortran_update.sh
	@${SHELL} ${builddir}/fortran_update.sh ${srcdir} cvbandf.f
	$(COMPILER_PREFIX) $(F77) $(FFLAGS) -c $(builddir)/cvbandf-updated.f
	$(LINKER_PREFIX) $(CC) -o $(builddir)/cvbandf $(builddir)/cvbandf-updated.o $(LDFLAGS) -L$(SUNDIALS_LIB_DIR) $(SUNDIALS_LIBS) $(LIBS) $(FLIBS) 

cvkryf: $(srcdir)/cvkryf.f fortran_update.sh
	@${SHELL} ${builddir}/fortran_update.sh ${srcdir} cvkryf.f
	$(COMPILER_PREFIX) $(F77) $(FFLAGS) -c $(builddir)/cvkryf-updated.f
	$(LINKER_PREFIX) $(CC) -o $(builddir)/cvkryf $(builddir)/cvkryf-updated.o $(LDFLAGS) -L$(SUNDIALS_LIB_DIR) $(SUNDIALS_LIBS) $(LIBS) $(FLIBS) 

cvkrybf: $(srcdir)/cvkrybf.f fortran_update.sh
	@${SHELL} ${builddir}/fortran_update.sh ${srcdir} cvkrybf.f
	$(COMPILER_PREFIX) $(F77) $(FFLAGS) -c $(builddir)/cvkrybf-updated.f
	$(LINKER_PREFIX) $(CC) -o $(builddir)/cvkrybf $(builddir)/cvkrybf-updated.o $(LDFLAGS) -L$(SUNDIALS_LIB_DIR) $(SUNDIALS_LIBS) $(LIBS) $(FLIBS) 

clean:
	rm -rf .libs
	rm -f *.lo
	rm -f *.o
	rm -f *-updated.f
	rm -f fortran_update.sh

uninstall: clean
	rm -f $(EXEC_FILES)
